<?php
session_start();

$username=$_SESSION['username'];
$connetc=mysql_connect("localhost","root","");
mysql_select_db("shenji",$connetc);
mysql_query("set names utf8");
$sql4="select * from user where username='$username'";

$result4=mysql_query($sql4);
$row4=mysql_num_rows($result4);


if($row4==0){
	echo "<script>alert('用户不存在，请重新登录！');top.location.href='./login.php'</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/jquery-1.6.3.min.js"></script>
</head>

<body>

	<div class="place">
    <span>位置</span>
    <ul class="placeul">
    <li><a href="#">项目管理</a></li>
    <li><a href="#">添加项目</a></li>			
    </ul>
    </div>
	
    <div class="formbody">
    <div class="formtitle"><span>基本信息</span></div>
	<form method="post" action="insert_xiangmu_commit.php">
	<input size="20" type="hidden" name="id" value="<?php echo $row['id'];?>">
    <ul class="forminfo">
    <li><label>项目名称</label><input  id="xmname" name="xmname" type="text"  onblur="shouzhong_name();" class="dfinput" /><i id="yz_name" style="display:none;color:#f00;">名称必须为中文，由中文且长度为2~5个字符</i></li>
	<li><label>英文名称</label><input  id="ename" name="ename" type="text"  onblur="shouzhong_ename();" class="dfinput" /><i id="yz_beizhu" style="display:none;color:#f00;">英文名称格式不正确(最好为其中文对应的名称)</i></li>
	<li>
		<label>处理候选码</label>
		<input type="radio"id="manage"name="manage" value="0" />开启
		<input type="radio"id="manage"name="manage" checked="checked" value="1" />关闭
	</li>
    <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="提交"/></li>
    </ul>
	</form>
    </div>
</body>
</html>

<script>
   function shouzhong_name(){
	var xmname=/^[\u4e00-\u9fa5]{2,5}$/;
	if(xmname.test($('#xmname').val())){
		$("#yz_name").hide();
	}else{
		$("#yz_name").show();
	}
$(function(){

	$("#xmname").focus(function(){
		$("#yz_name").hide();
	})
	$("#ename").focus(function(){
		$("#yz_beizhu").hide();
	})
})
	}
   	function shouzhong_ename(){
	var ename=/^[a-zA-Z]{1,20}$/;
	if(ename.test($('#ename').val())){
		$("#yz_beizhu").hide();
	}else{
		$("#yz_beizhu").show();
	}
	}
	$(function(){
		$('.btn').bind('click',function(event){
			var xmname=/^[\u4e00-\u9fa5]{2,5}$/;
			if(xmname.test($('#xmname').val())){
				$("#yz_name").hide();	
			}else{
				$("#yz_name").show();	
				return false;
			}			
		})
	})
		$(function(){
		$('.btn').bind('click',function(event){
			var ename=/^[a-zA-Z]{1,20}$/;
			if(ename.test($('#ename').val())){
				$("#yz_beizhu").hide();				
			}else{
				$("#yz_beizhu").show();		
				return false;
			}			
		})
	})
	 $(document).ready(function(){
	  
	  var username="<?php echo $_SESSION['username']; ?>";
	  if(username==null||username.length==0){		  
		 window.top.location.href="../login.php";
	  }
	  
  })
</script>




